package com.may.dataA.service;

import com.may.config.DataSource;
import com.may.dataA.mapper.UserMapper;
import com.may.dataB.mapper.CityMapper;
import com.may.dataC.mapper.RoleMapper;
import com.may.model.City;
import com.may.model.Role;
import com.may.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Youjie on 2017/7/23.
 */
@Service
public class IndexService {
    @Autowired
    UserMapper userMapper;

    @Autowired
    CityMapper cityMapper;

    @Autowired
    RoleMapper roleMapper;

    @DataSource("DATASOURCE_A")
    public List<User> findUser(){
        return userMapper.findUser();
    }
    @DataSource("DATASOURCE_B")
    public List<City> findCity(){
        return cityMapper.findCity();
    }
    @DataSource("DATASOURCE_C")
    public List<Role> findRole(){
        return roleMapper.findRole();
    }
}
